﻿using System;

class Gcd
{
    static void Yellow()
    {
        Console.ForegroundColor = ConsoleColor.Yellow;
    }

    static void White()
    {
        Console.ForegroundColor = ConsoleColor.White;
    }

    static void Main(string[] args)
    {
        Yellow();
        Console.WriteLine("8. Write a program that calculates the \ngreatest common divisor (GCD) of given two numbers. .\n");
        White();
        Console.Write("Enter first number :");
        int first = int.Parse(Console.ReadLine());
        Console.Write("Enter second number :");
        int second = int.Parse(Console.ReadLine());
        if (first < second) { int tmp = second; second = first; first = tmp; }
        GetGcd(first, second);
    }

    // using recurent function 
    static void GetGcd(int f, int s)
    {

        if (f % s == 0)
        {
            Console.WriteLine("GDS=" + s);
        }
        else
        {
            GetGcd(s, f % s);
        }


    }
}

